<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-tabs default-active-key="1">
          <a-tab-pane key="1" tab="基础信息">
            <a-row>
              <a-col :span="12" v-if="!model.id">
                <a-form-model-item label="资产类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
                  <j-dict-select-tag type="radio" v-model="model.type" dictCode="asset_type" placeholder="请选择资产类型" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12" v-else>
                <a-form-model-item label="资产编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="assetCode">
                  {{ model.assetCode }}
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="资产名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="assetName">
                  <a-input v-model="model.assetName" placeholder="请输入资产名称"  ></a-input>
                </a-form-model-item>
              </a-col>
            </a-row>
            <!-- 空间资产相关 -->
            <a-row v-if="model.type==='1'">
              <a-col :span="12">
                <a-form-model-item label="资产类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="assetType">
                  <j-dict-select-tag type="list" v-model="model.assetType" dictCode="asset_build_code" placeholder="请选择资产类型" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="空间类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spaceType">
                  <j-dict-select-tag type="list" v-model="model.spaceType" dictCode="space_type" placeholder="请选择空间类型" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="空间子类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spaceSubtype">
                  <j-dict-select-tag type="list" v-model="model.spaceSubtype" dictCode="space_subtype" placeholder="请选择空间子类" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="所属资产" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="belongAsset">
                  <j-dict-select-tag type="list" v-model="model.belongAsset" dictCode="belong_asset" placeholder="请选择所属资产" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="所属公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="company">
                  <j-dict-select-tag type="list" v-model="model.company" dictCode="asset_company" placeholder="请选择所属公司" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="详细地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="place">
                  <a-input v-model="model.place" placeholder="请输入详细地址"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="资产状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
                  <j-dict-select-tag type="list" v-model="model.status" dictCode="space_asset_status" placeholder="请选择资产状态" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargePerson">
                  <a-input v-model="model.chargePerson" placeholder="请输入负责人"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="不动产权力人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remainderman">
                  <a-input v-model="model.remainderman" placeholder="请输入不动产权力人"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeMobile">
                  <a-input v-model="model.chargeMobile" placeholder="请输入负责人联系电话"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="实物图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="physicalImage">
                  <j-image-upload isMultiple  v-model="model.physicalImage" ></j-image-upload>
                </a-form-model-item>
              </a-col>
            </a-row>
            <!-- 设备资产相关 -->
            <a-row v-if="model.type==='2'">
              <a-col :span="12">
                <a-form-model-item label="资产类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="assetType">
                  <j-dict-select-tag type="list" v-model="model.assetType" dictCode="asset_equipment_code" placeholder="请选择资产类型" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="设备分类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentCategory">
                  <j-dict-select-tag type="list" v-model="model.equipmentCategory" dictCode="asset_equip_type" placeholder="请选择设备分类" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="所属空间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="belongSpaceCode">
                  <j-dict-select-tag type="list" v-model="model.belongSpaceCode" dictCode="asset_message,asset_name,id" placeholder="请选择所属空间" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="所属资产" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="belongAsset">
                  <j-dict-select-tag type="list" v-model="model.belongAsset" dictCode="belong_asset" placeholder="请选择所属资产" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="所属公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="company">
                  <j-dict-select-tag type="list" v-model="model.company" dictCode="asset_company" placeholder="请选择所属公司" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="存放位置" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="place">
                  <a-input v-model="model.place" placeholder="请输入存放位置"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="资产状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
                  <j-dict-select-tag type="list" v-model="model.status" dictCode="equipment_asset_status" placeholder="请选择资产状态" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargePerson">
                  <a-input v-model="model.chargePerson" placeholder="请输入负责人"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeMobile">
                  <a-input v-model="model.chargeMobile" placeholder="请输入负责人联系电话"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="实物图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="physicalImage">
                  <j-image-upload isMultiple  v-model="model.physicalImage" ></j-image-upload>
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-tab-pane>
        </a-tabs>
        <!-- 仅空间资产显示 -->
        <span v-if="model.type==='1'">
          <a-tabs default-active-key="1" v-if="equipmentList && equipmentList.length>0">
            <a-tab-pane tab="设备资产信息" key="1">
              <j-vxe-table
                keep-source
                ref="equipmentTable"
                :columns="equipmentColumns"
                :dataSource="equipmentList"
                :maxHeight="400"
                :rowNumber="true"
                :rowSelection="false"
                :toolbar="false"
                />
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="物理属性" style="min-height: 300px">
              <a-col :span="12">
                <a-form-model-item label="建筑面积（㎡）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="buildingArea">
                  <a-input-number v-model="model.buildingArea" placeholder="请输入建筑面积（㎡）" :precision="2" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="可租面积（㎡）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rentableArea">
                  <a-input-number v-model="model.rentableArea" placeholder="请输入可租面积（㎡）" :precision="2" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="楼层信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="floorInfo">
                  <a-input v-model="model.floorInfo" placeholder="请输入楼层信息"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="装修信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="renovation">
                  <a-input v-model="model.renovation" placeholder="请输入装修信息"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="建成日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="completionYear">
                  <j-date placeholder="请选择建成日期" v-model="model.completionYear" 
                   style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="停车位数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parkingNum">
                  <a-input-number v-model="model.parkingNum" placeholder="请输入停车位数量" :precision="0" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="电梯数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="elevatorNum">
                  <a-input-number v-model="model.elevatorNum" placeholder="请输入电梯数量" :precision="0" style="width: 100%"></a-input-number>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="配套设施" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supportFacility">
                  <a-input v-model="model.supportFacility" placeholder="请输入配套设施"  ></a-input>
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1" >
            <a-tab-pane key="1" tab="价值和权属" style="min-height: 300px">
              <a-col :span="12">
                <a-form-model-item label="权属主体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ownershipSubject">
                  <a-input v-model="model.ownershipSubject" placeholder="请输入权属主体"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="取得方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="acquisitionMethod">
                  <j-dict-select-tag type="list" v-model="model.acquisitionMethod" dictCode="acquisition_method" placeholder="请选择取得方式" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="账面原值（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bookOriginalValue">
                  <a-input-number v-model="model.bookOriginalValue" :precision="2" placeholder="请输入账面原值（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="账面净值（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bookNetValue">
                  <a-input-number v-model="model.bookNetValue" :precision="2" placeholder="请输入账面净值（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="折旧起始年月" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="depreciationStartDate">
                  <j-date placeholder="请选择折旧起始年月" v-model="model.depreciationStartDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="月折旧额（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="monthDepreciationFee">
                  <a-input-number v-model="model.monthDepreciationFee" :precision="2" placeholder="请输入月折旧额（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="权证办理状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certificateStatus">
                  <j-dict-select-tag type="list" v-model="model.certificateStatus" dictCode="certificate_status" placeholder="请选择权证办理状态" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="资产类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isFixedAsset">
                  <j-dict-select-tag  v-model="model.isFixedAsset" dictCode="asset_type_space" placeholder="请选择资产类型" />
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="经营状况">
              <a-col :span="12">
                <a-form-model-item label="经营单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operationUnit">
                  <a-input v-model="model.operationUnit" placeholder="请输入经营单位"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="可否对外招租" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="canRent">
                  <j-dict-select-tag type="radio" v-model="model.canRent" dictCode="is_fixed_asset" placeholder="请选择可否对外招租" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="已租面积（㎡）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rentedArea">
                  <a-input-number v-model="model.rentedArea" :precision="2" placeholder="请输入已租面积（㎡）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="参考租金（元/㎡/月）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="referenceRent">
                  <a-input-number v-model="model.referenceRent" :precision="2" placeholder="请输入参考租金（元/㎡/月）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="年度收入（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="annualIncome">
                  <a-input-number v-model="model.annualIncome" :precision="2" placeholder="请输入年度收入（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="物业管理">
              <a-col :span="12">
                <a-form-model-item label="管理单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyCompany">
                  <a-input v-model="model.propertyCompany" placeholder="请输入管理单位"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="能源费（元/月/㎡）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="energyFee">
                  <a-input-number v-model="model.energyFee" :precision="2" placeholder="请输入能源费（元/月/㎡）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="车位费（元/月）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parkingFee">
                  <a-input-number v-model="model.parkingFee" :precision="2" placeholder="请输入车位费（元/月）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="物业费单价（元/月/㎡）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyFeeUnit">
                  <a-input-number v-model="model.propertyFeeUnit" :precision="2" placeholder="请输入物业费单价（元/月/㎡）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="年物业费（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="annualPropertyFee">
                  <a-input-number v-model="model.annualPropertyFee" :precision="2" placeholder="请输入年物业费（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="空房管理费（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="vacantManagementFee">
                  <a-input-number v-model="model.vacantManagementFee" :precision="2" placeholder="请输入空房管理费（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="关联设施系统">
              <a-col :span="12">
                <a-form-model-item label="视频监控系统" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="videoSurveillance">
                  <a-textarea v-model="model.videoSurveillance" placeholder="请输入视频监控系统" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="门禁安防系统" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accessControl">
                  <a-textarea v-model="model.accessControl" placeholder="请输入门禁安防系统" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="核心动转设备" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coreOperationEquipment">
                  <a-textarea v-model="model.coreOperationEquipment" placeholder="请输入核心动转设备" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="网络情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="networkCondition">
                  <a-textarea v-model="model.networkCondition" placeholder="请输入网络情况" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="机房" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="machineRoom">
                  <a-textarea v-model="model.machineRoom" placeholder="请输入机房状态" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="控制室" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="controlRoom">
                  <a-textarea v-model="model.controlRoom" placeholder="请输入控制室状态" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="设备房" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentRoom">
                  <a-textarea v-model="model.equipmentRoom" placeholder="请输入设备房状态" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="其他资料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="otherData">
                  <a-textarea v-model="model.otherData" placeholder="请输入其他配套设施相关资料" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="关联文档">
              <a-col :span="12">
                <a-form-model-item label="不动产权证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certEstateRight">
                  <j-upload v-model="model.certEstateRight"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="土地使用证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certLandUse">
                  <j-upload v-model="model.certLandUse"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="建设工程备案证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certConstructionRecord">
                  <j-upload v-model="model.certConstructionRecord"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="规划许可证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certPlanningPermit">
                  <j-upload v-model="model.certPlanningPermit"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="消防验收证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certFireInspection">
                  <j-upload v-model="model.certFireInspection"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="环保验收证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="certEnvironmentalInspection">
                  <j-upload v-model="model.certEnvironmentalInspection"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="平面图纸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docLayoutDrawing">
                  <j-upload v-model="model.docLayoutDrawing"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="CAD图纸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docCadDrawing">
                  <j-upload v-model="model.docCadDrawing"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="招商资料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docInvestment">
                  <j-upload v-model="model.docInvestment"></j-upload>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="其他资料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docOther">
                  <j-upload v-model="model.docOther"></j-upload>
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
        </span>
        <span v-if="model.type==='2'">
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="技术规格"  style="min-height: 300px">
              <a-col :span="12">
                <a-form-model-item label="品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brand">
                  <a-input v-model="model.brand" placeholder="请输入品牌"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="规格型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="model">
                  <a-input v-model="model.model" placeholder="请输入规格型号"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="技术参数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="technicalParams">
                  <a-textarea v-model="model.technicalParams" rows="4" placeholder="请输入技术参数" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="制造商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manufacturer">
                  <a-input v-model="model.manufacturer" placeholder="请输入制造商"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="国别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="country">
                  <a-input v-model="model.country" placeholder="请输入国别"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="出厂编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factorySerial">
                  <a-input v-model="model.factorySerial" placeholder="请输入出厂编号"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="出厂日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryDate">
                  <j-date placeholder="请选择出厂日期" v-model="model.factoryDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1" >
            <a-tab-pane key="1" tab="采购与价值" style="min-height: 300px">
              <a-col :span="12">
                <a-form-model-item label="供应商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplier">
                  <a-input v-model="model.supplier" placeholder="请输入供应商"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="采购日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="purchaseDate">
                  <j-date placeholder="请选择采购日期" v-model="model.purchaseDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="合同编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contractCode">
                  <a-input v-model="model.contractCode" placeholder="请输入合同编号"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="账面原值（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bookOriginalValue">
                  <a-input-number v-model="model.bookOriginalValue" :precision="2" placeholder="请输入账面原值（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="账面净值（元）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bookNetValue">
                  <a-input-number v-model="model.bookNetValue" :precision="2" placeholder="请输入账面净值（元）" style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="折旧起始年月" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="depreciationStartDate">
                  <j-date placeholder="请选择折旧起始年月" v-model="model.depreciationStartDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="保修截止日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warrantyEndDate">
                  <j-date placeholder="请选择保修截止日期" v-model="model.warrantyEndDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="维修信息" style="min-height: 300px">
              <a-col :span="12">
                <a-form-model-item label="维修状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenanceStatus">
                  <j-dict-select-tag type="list" v-model="model.maintenanceStatus" dictCode="maintenance_status" placeholder="请选择维修状态" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="维修服务商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenanceCompany">
                  <a-input v-model="model.maintenanceCompany" placeholder="请输入维修服务商"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="维修合同" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairContract">
                  <a-input v-model="model.repairContract" placeholder="请输入维修合同"  ></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="上次维修日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lastMaintenanceDate">
                  <j-date placeholder="请选择上次维修日期" v-model="model.lastMaintenanceDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="下次维修日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nextMaintenanceDate">
                  <j-date placeholder="请选择下次维修日期" v-model="model.nextMaintenanceDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="检验日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inspectDate">
                  <j-date placeholder="请选择检验日期" v-model="model.inspectDate"  style="width: 100%" />
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="关联文档">
              <a-row>
                <a-col :span="12">
                  <a-form-model-item label="设备档案/说明" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docEquipmentFile">
                    <j-upload v-model="model.docEquipmentFile"></j-upload>
                  </a-form-model-item>
                </a-col>
                <a-col :span="12">
                  <a-form-model-item label="图纸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docDrawing">
                    <j-upload v-model="model.docDrawing"></j-upload>
                  </a-form-model-item>
                </a-col>
                <a-col :span="12">
                  <a-form-model-item label="权属证件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docOwnership">
                    <j-upload v-model="model.docOwnership"></j-upload>
                  </a-form-model-item>
                </a-col>
                <a-col :span="12">
                  <a-form-model-item label="使用许可证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docOperationPermit">
                    <j-upload v-model="model.docOperationPermit"></j-upload>
                  </a-form-model-item>
                </a-col>
                <a-col :span="12">
                  <a-form-model-item label="检验合格证" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docInspectionCert">
                    <j-upload v-model="model.docInspectionCert"></j-upload>
                  </a-form-model-item>
                </a-col>
                <a-col :span="12">
                  <a-form-model-item label="其他资料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="docOther">
                    <j-upload v-model="model.docOther"></j-upload>
                  </a-form-model-item>
                </a-col>
              </a-row>
            </a-tab-pane>
          </a-tabs>
        </span>
        <a-row>
          <!-- <a-col :span="12">
            <a-form-model-item label="资产编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="assetCode">
              <a-input v-model="model.assetCode" placeholder="请输入资产编码"  ></a-input>
            </a-form-model-item>
          </a-col> -->
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="其他">
              <a-col :span="12">
                <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
                  <a-textarea v-model="model.remark" placeholder="请输入备注" rows="3"></a-textarea>
                </a-form-model-item>
              </a-col>
            </a-tab-pane>
          </a-tabs>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'

  export default {
    name: 'AssetMessageForm',
    mixins: [JVxeTableModelMixin],
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model:{
          type: '1'
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
           assetCode: [
              { required: true, message: '请输入资产编码!'},
           ],
           assetName: [
              { required: true, message: '请输入资产名称!'},
           ],
          //  chargePerson: [
          //     { required: true, message: '请输入负责人!'},
          //  ],
          //  chargeMobile: [
          //     { required: true, message: '请输入负责人联系电话!'},
          //  ],
           company: [
              { required: true, message: '请选择所属公司!'},
           ],
           belongSpaceCode: [
              { required: true, message: '请选择所属空间!'},
           ],
           completionYear: [
              { required: true, message: '请选择建成日期!'},
           ],
           purchaseDate: [
              { required: true, message: '请选择采购日期!'},
           ],
           spaceType: [
              { required: true, message: '请选择空间类型!'},
           ],
           belongAsset: [
              { required: true, message: '请选择所属资产!'},
           ],
           assetType: [
              { required: true, message: '请选择资产类型!'},
           ],
        },
        url: {
          add: "/asset/assetMessage/add",
          edit: "/asset/assetMessage/edit",
          queryById: "/asset/assetMessage/queryById",
          listByPlace: "/asset/assetMessage/listByPlace"
        },
        editType: '',
        equipmentList: [],
        equipmentColumns: [
            {
              title: '设备资产编码',
              key: 'assetCode',
              type: JVXETypes.input,
              width: "20%",
              placeholder: '请输入${title}',
              defaultValue:'',
              disabled:true,
            },
            {
              title: '设备资产名称',
              key: 'assetName',
              type: JVXETypes.input,
              width: "20%",
              placeholder: '请输入${title}',
              defaultValue:'',
              disabled:true,
            },
            {
              title: '存放位置',
              key: 'place',
              type: JVXETypes.input,
              width: "50%",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.editType = 'add';
        this.edit(this.modelDefault);
      },
      edit (record) {
        const that = this;
        this.model = Object.assign({}, record);
        this.visible = true;
        // 加载 获取空间资产下，设备资产，存放位置为null
        if(this.editType != 'add' && this.model.type == '1'){
          getAction(this.url.listByPlace + '?id=' + this.model.id).then((res)=>{
            if(res.success){
              that.equipmentList = res.result;
            }else{
              that.$message.warning(res.message);
            }
          })
        }
      },
      submitForm () {
        const that = this;
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            if(this.equipmentList.length>0){
              // 设置设备资产存放位置
              this.model.equipmentList = this.equipmentList.map(item=>({
                id: item.id,
                place: item.place
              }));
            }else{
              this.model.equipmentList = [];
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
         
        })
      },
    }
  }
</script>
<style scoped>

</style>